//对前加加和后加加进行重载
#include <iostream>
using namespace std;

class point
{

    int a;
    int b;

public:
    point(int m_a, int m_b) : a(m_a), b(m_b){};
    void display()
    {
        cout << a << b << endl;
    }
    point &operator++() //前置加加 返回的他自己，可以被赋值 所以是引用，
    {

        a++;
        b++;
        return *this;
    }
    point operator++(int) //后置++
    {
        point old = *this; //保存旧的对象
        //point old = point(a, b);保存旧的对象
        // point old(a, b);保存旧的对象
        a++;
        b++;
        return old; //返回旧的对象，实际上对象的成员已经自加了
    }
};
int main()
{
    point p1(3, 5);
    point p2 = ++p1; //相当于operator++(p1)
    point p3(3, 5);
    point p4 = p3++;
    p2.display();
    p4.display();
}